<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
    
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>상품 상세</title>
<script type="text/javascript">
	var del = ${member.pr_num};
	var del2 = ${member.p_code};
	function deleteMac(){
		if(confirm("지우시겠습니까?")){
			location.href='reviewDelete.do?rv_num='+del+"&p_code="+del2;
		}else{
			return false;
		}
	}
</script>
</head>
<body>
<br><br><br><br>
<fieldset>
	<legend align="left"><font size="8" face="돋음">사용 후기</font></legend>
<table>
	<tr>
		<td> ID :${member.userid}</td><td> 작성일 : <fmt:formatDate pattern="yyyy년 MM월 dd일 a"  value="${member.pr_writeday}"/></td>
	</tr>
	<tr>
		<td> 제목 : ${member.pr_title}</td><td> 조횟수 : ${member.pr_readcnt}</td>
	</tr>
	<tr>
		<td colspan="2" align="center">내용</td>
	</tr>
	<tr>
		<td colspan="2">${member.pr_content}</td>
	</tr>
	<tr>
		<td colspan="2" align="center"> 이 미 지 </td>
	</tr>
	<tr>
		<td colspan="2">
		<c:choose>
		<c:when test="${member.pr_image != null}">
		<img src="../amemberUpload/${member.pr_image}" width="350" height="400">
		</c:when>
		<c:otherwise>
		등록된 사진이 없습니다.
		</c:otherwise>		
		</c:choose>
		</td>
	</tr>
	<tr>
		<td align="right" colspan="2">
				<%
					HttpSession session2 = request.getSession();
					String userId4 = (String)session.getAttribute("userid");
				%>
				<c:set var="id" value="<%=userId4 %>"/>
				<c:if test="${member.userid == id}">
				<input type="button" value="삭제" onclick='deleteMac()'>&nbsp;
				</c:if>
				<c:if test="${member.userid == id}">
				<input type="button" value="수정" onclick="location.href='reviewUpdate.do?pr_num=${member.pr_num}'">&nbsp;
				</c:if>
				<input type="button" value="목록" onclick="location.href='detailPro.do?p_code=${member.p_code}#2'">
		</td>
	</tr>
	</table>	
</fieldset>

</body>
</html>    